package com.ynunicom.dc.dingdingcontractapp.configuration;

import com.ynunicom.dc.dingdingcontractapp.configuration.properties.SkipReviewProperties;
import com.ynunicom.dc.dingdingcontractapp.entity.RepositoryEntity;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author: jinye.Bai
 * @date: 2020/6/11 15:01
 */
@EnableConfigurationProperties(SkipReviewProperties.class)
@Configuration
public class RepositoryConfig {

    @Resource
    SkipReviewProperties skipReviewProperties;

    @Bean
    public RepositoryEntity repositoryEntity(){
        if (skipReviewProperties.getEnable()){
            RepositoryEntity repositoryEntity = new RepositoryEntity();
            repositoryEntity.setKey("ContractApplyForYnUnicom");
            return repositoryEntity;
        }
        else {
            RepositoryEntity repositoryEntity = new RepositoryEntity();
            repositoryEntity.setKey("ContractApplyForYnUnicomWithoutListener");
            return repositoryEntity;
        }
    }

}
